﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
/// <summary>
///WebForm 的摘要说明
/// </summary>
public class WebForm:PageBase
{
    protected const string SessionUser = "UserSession";
    /// <summary>
    /// 
    /// </summary>
    /// <param name="e"></param>
    protected override void OnInit(EventArgs e)
    {
        string applicationPath = base.Request.ApplicationPath;
        if (!applicationPath.EndsWith("/"))
        {
            applicationPath = applicationPath + "/";
        }
        //登陆继续往下执行
        //if (this.Session[SessionUser] == null)
        if (GetClientCookies() == null)
        {
            string str2 = base.Request.RawUrl.ToString();
            RedirectNewURL(string.Format("{0}Default/index.aspx?url={1}", applicationPath, str2));
            base.Response.End();
        }
        base.OnInit(e);
    }

    protected void SetClientDate(string clientId, DateTime time)
    {
        StringBuilder sb = new StringBuilder();
        sb.Append("<script type='text/javascript'>");
        //sb.Append(string.Format("$(document).ready(function(){$('#{0}').datepicker('setDate', new Date({1},{2},{3}));});", clientId, time.Year, (time.Month - 1), time.Day));
        sb.Append("$(document).ready(function(){$('#" + clientId + "').datepicker('setDate', new Date(" + time.Year + "," + (time.Month - 1) + "," + time.Day + "));});");
        sb.Append("</script>");
        Page.ClientScript.RegisterStartupScript(this.GetType(), clientId, sb.ToString());
    }
}